package com.study.springbootsecurity.util;

import com.google.common.hash.Hashing;
import jakarta.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;

/**
 * @Description: TODO 设备指纹工具类
 * @author: Huangjianyun
 * @date: 2025-06-09 17:27
 */
public class DeviceFinerUtil {

    public static String buildDeviceFingerprint(HttpServletRequest request) {
        String ip = ServletUtil.getClientIP(request);
        String userAgent = request.getHeader("User-Agent");
        return Hashing.sha256().hashString(ip + userAgent, StandardCharsets.UTF_8).toString();
    }
}
